<script setup lang="ts">

import { ref } from 'vue';
let isShow=ref(true);
isShow.value=false;

let onShow= ()=>{
    isShow.value=!isShow.value
}
</script>

<template>
    <h1 v-if="isShow">你好</h1>
    <h1 v-else>我不好</h1>
    <button @click="onShow">显示</button>
    <h2 v-show="isShow">hello</h2>
</template>

<style scoped></style>